package com.power.controller.DefectAd;

import com.alibaba.fastjson.JSONObject;
import com.power.common.Contants;
import com.power.ov.ResultData;
import com.power.pojo.Defecttype;
import com.power.service.DefectAdService;
import com.power.service.impl.defectAdServiceImpl;
import com.power.utils.WriterUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.sql.SQLException;

/**
 * Created/**
 * Created with IntelliJ IDEA.
 * User: lh
 * Date: 2020/09/29 21:01
 * Description:确认缺陷级别
 * Version: V1.0
 */
@WebServlet("/updategrade.do")
public class UpdateGradeServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       String defect_grade=req.getParameter("defect_grade_name");
       String  task_id=req.getParameter("task_id");
        DefectAdService defectAdService=new defectAdServiceImpl();
        ResultData resultData=new ResultData();
        try {
            resultData=defectAdService.updateGrade(defect_grade,task_id);
        } catch (SQLException e) {
            resp.setContentType("application/json;charset=utf-8");
            resultData.setCode(Contants.EXCEPTION);
            resultData.setMsg("系统开小差了...");
            e.printStackTrace();
        }
        System.out.println(resultData);
        WriterUtil.getWriter(resp,resultData);
    }
}
